<?php

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 * author Hieu Ho
 */

class Seektutor_model extends CI_Model {

    //put your code here
    public function __construct() {
        parent::__construct();
    }

    public function add_timgiasu($id) {
        $this->db->select('thanhvien_id');
        $this->db->where('thanhvien_id', $id);
        $lamgiasu = $this->db->get('gs7s_timgiasu');
        $monhoc = '';
        foreach ($this->input->post('monhoc') as $tungmonhoc) {
            $monhoc = $monhoc . ' ' . $tungmonhoc;
        }
//        print_r($monhoc);
        $data = array(
            'thanhvien_id' => $id,
            'TimGiaSu_TrangThai_id' => '1',
//            'DiaChi' => $this->input->post('address'),
//            'DienThoaiBan' => $this->input->post('landline'),
//            'DienThoaiDiDong' => $this->input->post('mobile'),
            'Truong' => $this->input->post('school'),
            'Lop' => $this->input->post('class'),
            'SoBuoi' => $this->input->post('numberday'),
            'ThoiGianHoc' => $this->input->post('timelearn'),
            'SoLuongHocSinh' => $this->input->post('numberstudent'),
            'GioiTinh' => $this->input->post('sex'),
            'YeuCauKhac' => $this->input->post('otherrequirment'),
            'TrinhDo_id' => $this->input->post('level'),
            'MonHoc' => $monhoc,
            'hocphi' => $this->input->post('hocphi')
        );
        print_r($this->input->post('sex'));
//        if ($lamgiasu->num_rows == 0)
        $this->db->insert('gs7s_timgiasu', $data);
//        else {
//            $this->db->where('thanhvien_id', $id);
//            $this->db->update('gs7s_timgiasu', $data);
//        }
    }

}

?>
